package {

	/**
	 * @author maxim.zaks@gmail.com
	 */
	import mz.behaveas.model.spec.Specification;
	import mz.behaveas.model.spec.SpecificationFactory;

	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.events.*;
	import flash.net.URLRequest;

	public class MainRunner extends Sprite {

		private var mLoader : Loader;

		public function MainRunner() {
			mLoader = new Loader();
			var mRequest : URLRequest = new URLRequest("MySpec.swf");
			mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onChild1Complete);
			//mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
			mLoader.load(mRequest);
		}

		private function onChild1Complete(e : Event) : void {
			var co : MySpec = mLoader.content as MySpec;
			for each (var spec : Object in co.specs) {
				var actSpec : Specification = SpecificationFactory.createSpec(spec);
//				actSpec.runExpectations();
				trace(actSpec.report);
			}
		}
	}
}
